You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
701 B
17 lines
701 B
import { updateItemVisibility } from "#server/service/rss";
|
|
import { visibilitySchema } from "#server/constants/visibility";
|
|
|
|
export default defineWrappedResponseHandler(async (event) => {
|
|
const user = await event.context.auth.requireUser();
|
|
const id = Number(event.context.params?.id);
|
|
if (!Number.isInteger(id)) {
|
|
throw createError({ statusCode: 400, statusMessage: "无效 id" });
|
|
}
|
|
const body = await readBody<{ visibility: string }>(event);
|
|
const vis = visibilitySchema.parse(body.visibility);
|
|
const item = await updateItemVisibility(user.id, id, vis);
|
|
if (!item) {
|
|
throw createError({ statusCode: 404, statusMessage: "未找到" });
|
|
}
|
|
return R.success({ item });
|
|
});
|
|
|